import http from '../../utils/request/request'


//获取商家所有投入品信息 （信息存储在store）
export function getShopSupply() {
    return http({
        url: '/breed/merchant/supply',
        method: 'get'
    })
}

//获取所有基地信息
export function getAllBaseInfo() {
    return http({
        url: `/breed/base/baseMap`,
        method: 'get'
    })
}

// 分页获取基地投入品
export function getBaseSupplyInfo(id = 1, size = 5, page = 1) {
    return http({
        url: `/breed/supply/management/one/base/${id}/${size}/${page}`,
        method: 'get'
    })
}

// 非分页获取企业投入品
export function getEnterpriseInputs() {
    return http({
        url: `/breed/supply/management/all`,
        method: 'get'
    })
}

//非分页获取基地投入品
// export function getBaseInputs(){
//     return http({
//         url:`/breed/supply/management/all`,
//         method:'get'
//     })
// }
//分页获取企业投入品信息
// export function getAllSupplyInfo(size=3,page=1){
//     return http.supplier({
//         url: `/breed/supply/management/all/${size}/${page}`,
//         method: 'get'
//     })
// }

export function getBaseSupplyData(id, size, page) {
    return http({
        url: `/breed/supply/management/one/base/${id}/${size}/${page}`,
        method: 'get'
    })
}
//删除文件
export function fileDelete(path) {
    return http({
        url: `/file/delete/${path}`,
        method: 'delete'
    })
}

//分页获取企业投入品库存信息
export function getInputinVentory(size = 5, page = 1) {
    return http({
        url: `/breed/supply/management/all/${size}/${page}`,
        method: 'get'
    })
}

//删除单个投入品库存信息
export function deleteInventoryInfo(id) {
    return http({
        url: `/breed/supply/management/${id}`,
        method: 'delete'
    })
}

//批量删除投入品库存信息
export function deleteInventoryInfoBath(ids) {
    return http({
        url: `/breed/supply/management/batch`,
        method: 'delete',
        data: ids
    })
}

//模糊查询商家投入品
export function vagueSearchShopSupply(data, size = 5, page = 1) {
    return http({
        url: `/breed/merchant/supply/search/${size}/${page}`,
        data,
        method: 'post'
    })
}

//供应商模糊查询
export function vagueSearchSupplier(data, size = 5, page = 1) {
    return http({
        url: `/breed/supplier/search/${size}/${page}`,
        data,
        method: 'post'
    })
}

//企业投入品模糊查询
export function vagueSearchSupply(data, size = 5, page = 1) {
    console.log(data)
    
    return http({
        url: `/breed/supply/management/search/${size}/${page}`,
        data,
        method: 'post'
    })
}

//企业投入品出库模糊查询
export function vagueSearchSupplyOut(data, size = 5, page = 1) {
    return http({
        url: `/breed/supply/out/record/search/${size}/${page}`,
        data,
        method: 'post'
    })
}

//企业投入品入库模糊查询
export function vagueSearchSupplyIn(data, size = 5, page = 1) {
    return http({
        url: `/breed/supply/in/record/search/${size}/${page}`,
        data,
        method: 'post'
    })
}

//根据sku查找
export function searchBySku(id) {
    return http({
        url: `/breed/supply/management/map/${id}`,
        method: 'get'
    })
}
